Skip to content

test: extend max-depth stress coverage (#140)#146

Merged
membphis merged 1 commit into
mainfrom
test/max-depth-stress-140
Jun 1, 2026
Merged

test: extend max-depth stress coverage (#140)#146
membphis merged 1 commit into
mainfrom
test/max-depth-stress-140

Conversation

@membphis
Copy link
Copy Markdown
Collaborator

@membphis membphis commented Jun 1, 2026

Closes #140.

What

Adds deterministic max-depth boundary tests that pin the named limits the fuzz_depth target only reaches probabilistically. As noted in the issue review, roughly 70% of the acceptance criteria were already covered (#142 mode relations, fuzz_depth, ffi_parse_error_offsets, options.rs unit tests, options_spec.lua), so this PR is scoped to the genuine deterministic gaps and does not re-cover EAGER/LAZY equivalence.

tests/ffi_depth_stress.rs (new)

  • default max_depth = 0 -> 1024 resolved at the FFI/parse level: accept 1024, reject 1025 with offset 1024
  • 4096 ceiling: accept 4096, reject 4097
  • clamp of over-ceiling requests (4097, 5000, u32::MAX) to 4096 — verifies the larger request is not honored
  • object-only and mixed nesting boundaries (deterministic coverage was array-only)
  • pathological 100k-deep input rejects fast as QJSON_NESTING_TOO_DEEP without recursing
  • cursor reachability of an accepted at-limit (1024-deep) document down to the innermost scalar

All cases run in both EAGER and LAZY modes.

tests/lua/options_spec.lua

  • propagate default-depth nesting error (1025) in both default and lazy mode
  • accept exactly 1024 at the default
  • clamp an over-ceiling max_depth to 4096 through the wrapper

without duplicating the existing accept / message / lazy / fractional cases.

Stress placement

The deep stress case is a lightweight deterministic test running in the standard CI gates (cargo test --release and --no-default-features); fuzz_depth continues to provide randomized exploration. No separate scheduled workflow is needed. EAGER/LAZY depth equivalence is already fixed by #142 and is intentionally not re-covered.

Verification

  • cargo test --release — 168 + all integration tests pass
  • cargo test --release --no-default-features --test ffi_depth_stress — pass (scalar parity)
  • cargo clippy --release --all-targets -- -D warnings — clean
  • Lua busted options_spec.lua — 12/12 pass

Add deterministic boundary tests that pin the named max-depth limits the
fuzz_depth target only reaches probabilistically:

- tests/ffi_depth_stress.rs: default max_depth=0 -> 1024 resolution at the
  FFI/parse level (accept 1024, reject 1025), the 4096 ceiling (accept
  4096, reject 4097), clamp of over-ceiling requests (5000 / u32::MAX),
  object-only and mixed nesting boundaries (deterministic coverage was
  array-only elsewhere), a pathological 100k-deep input that must reject
  fast without recursing, and cursor reachability of an at-limit document.
  All cases run in both EAGER and LAZY modes.
- tests/lua/options_spec.lua: propagate default-depth and clamped-ceiling
  nesting errors through the Lua wrapper without duplicating the existing
  accept/message/lazy/fractional cases.

The deep stress case is a lightweight deterministic test in the standard
CI gates; fuzz_depth continues to provide randomized exploration. EAGER/
LAZY depth equivalence is already fixed by #142 and is not re-covered.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Warning

Review limit reached

@membphis, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 8 minutes and 3 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 777219ff-9b86-4255-a59a-e638890ee835

📥 Commits

Reviewing files that changed from the base of the PR and between 58f10eb and dc8debe.

📒 Files selected for processing (2)
  • tests/ffi_depth_stress.rs
  • tests/lua/options_spec.lua
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/max-depth-stress-140

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@membphis membphis merged commit 7bff13a into main Jun 1, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: 扩展 max-depth stress tests

1 participant